package com.jt.assistant.adapter

import android.annotation.SuppressLint
import android.view.View
import android.widget.ImageView
import coil.load
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.jt.assistant.R
import com.jt.assistant.base.BaseApplication

class PicAdapter(mData: MutableList<String>) :
    BaseQuickAdapter<String, BaseViewHolder>(
        R.layout.item_pic, mData
    ) {

    @SuppressLint("SetTextI18n")
    override fun convert(holder: BaseViewHolder, item: String) {
        val ivPic = holder.getView<View>(R.id.iv_pic) as ImageView
        if (item.isEmpty())
            Glide.with(BaseApplication.getContext())
                .load(R.mipmap.ic_add_pic)
                .into(ivPic)
        else
            Glide.with(BaseApplication.getContext())
                .load(item)
                .into(ivPic)
    }


}